{% extends "base.html" %}
{% load static %}
{% block  title %}工具添加{% endblock %}
{% block header-css %}
    <link href="{% static  "css/plugins/codemirror/codemirror.css" %}" rel="stylesheet">
    <link href="{% static  "css/plugins/codemirror/ambiance.css" %}" rel="stylesheet">
    <link href="{% static  "css/plugins/codemirror/fold/foldgutter.css" %}" rel="stylesheet">
    {% load	bootstrap3 %}
{% endblock %}


{% block page-content %}

    <div class="row wrapper border-bottom white-bg page-heading">
        <div class="col-lg-10">
            <h2>工具添加</h2>
            <ol class="breadcrumb">
                <li>
                    <a href="/index.html">主页</a>
                </li>
                <li>
                    <a href="tools.html">工具</a>
                </li>
                <li class="active">
                    <strong>工具添加</strong>
                </li>
            </ol>
        </div>
        <div class="col-lg-2">

        </div>
    </div>


    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>工具添加</h5>
                    <div style="color:red;">   添加python脚本 开头必须要写  #!/usr/bin/python</div>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                            <i class="fa fa-wrench"></i>
                        </a>
                        <ul class="dropdown-menu dropdown-user">
                            <li><a href="#">选项 1</a>
                            </li>
                            <li><a href="#">选项 2</a>
                            </li>
                        </ul>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <form class="form-horizontal" action="{% url "tasks:tools_add"  %}"   method="post"
                         >
                        {% csrf_token %}
                        {% if form.no_field_errors %}
                            <div class="alert alert-danger" style="margin: 20px auto 0px">
                                {{ form.non_field_errors }}
                            </div>
                        {% endif %}

                        <div class="form-group">
                            <div class="col-sm-10 col-sm-offset-0">
                                {% bootstrap_field form.name layout="horizontal" %}
                                {% bootstrap_field form.tool_script layout="horizontal" %}
                                {% bootstrap_field form.tool_run_type layout="horizontal" %}
                                {% bootstrap_field form.comment layout="horizontal" %}
                            </div> </div>

                        <div class="hr-line-dashed"></div>


                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-3">

                                <button class="btn btn-primary" type="submit">保存</button>
                                <button class="btn btn-white" type="reset">重置</button>
                            </div>
                        </div>


                    </form>


                </div>
            </div>
        </div>

    </div>


    {% block footer-js %}

        <script src="{% static  "js/plugins/codemirror/codemirror.js" %}"></script>
        <script src="{% static "js/plugins/codemirror/mode/shell.js" %}"></script>
        <script src="{% static "js/plugins/codemirror/mode/python.js" %}"></script>
        <script src="{% static "js/plugins/codemirror/mode/yaml.js" %} "></script>

        <script src="{% static "js/plugins/codemirror/fold/brace-fold.js" %} "></script>
        <script src="{% static "js/plugins/codemirror/fold/comment-fold.js" %} "></script>
        <script src="{% static "js/plugins/codemirror/fold/foldcode.js" %} "></script>
        <script src="{% static "js/plugins/codemirror/fold/foldgutter.js" %} "></script>
        <script src="{% static "js/plugins/codemirror/fold/indent-fold.js" %} "></script>
        <script src="{% static "js/plugins/codemirror/fold/markdown-fold.js" %} "></script>
        <script src="{% static "js/plugins/codemirror/fold/xml-fold.js" %} "></script>

        <script src="{% static "js/plugins/codemirror/edit/matchbrackets.js" %} "></script>



        <script>
            $(document).ready(function () {
                $('.select2').select2();

                var editor_two = CodeMirror.fromTextArea(document.getElementById("id_tool_script"), {
                    lineNumbers: true,
                    matchBrackets: true,
                    styleActiveLine: true,
                    lineWrapping: true,
                    foldGutter: true,
                    gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]


                });


            });

        </script>


    {% endblock %}


{% endblock %}